#pragma comment(linker, "/STACK:10000000")
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <cstdio>
#include <cassert>
#include <string>
#include <cstring>
#define ldb long double
#define LL long long
#define fi first
#define se second
#define fill(a, c) memset(a, c, sizeof(a))
#define sqr(a) ((a) * (a))
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define getBit(mask, k) (((mask) / pw[k]) % pw[1])
#define setBit(mask, k, l) (((mask) / pw[k + 1] * pw[1] + (l)) * pw[k] + ((mask) % pw[k]))
#define debug(a) cerr << #a << " = " << a << " ";
#define debugl(a) cerr << #a << " = " << a << "\n";
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define ff first
#define ss second 
const ldb LDINF = 9128739847123.00;
const ldb eps = 1e-9;
const int inf = 1 << 28;
const ldb pi = fabsl(atan2l(0.0, -1.0));
using namespace std;
int ti, td, tr, te;
string s, t;
int n, m;
int f[4001][4002];
int ps[26], pt[26];




void load()
{
	cin >> ti >> td >> tr >> te;
	cin >> s >> t;
	n = s.size();
	m = t.size();
	s = '$' + s;
	t = '$' + t;
}

void solve()
{
	memset(f, 0x7f, sizeof f);
	for (int i = 0; i <= n; i++)
		f[i][0] = td * i;
	for (int i = 0; i <= m; i++)
		f[0][i] = ti * i;

	for(int i = 1; i <= n; i++)
    {
    	memset(pt, 0, sizeof pt);
        for(int j = 1; j <= m; j++)
        {
            if (s[i] == t[j])
                    f[i][j] = min(f[i][j], f[i - 1][j - 1]);
            f[i][j] = min(f[i][j], f[i][j - 1] + ti);
            f[i][j] = min(f[i][j], f[i - 1][j] + td);
            f[i][j] = min(f[i][j], f[i - 1][j - 1] + tr);
            if (ps[t[j] - 'a'] && pt[s[i] - 'a'])
                    f[i][j] = min(f[i][j], f[ps[t[j] - 'a'] - 1][pt[s[i] - 'a'] - 1] 
                    	+ td * (i - ps[t[j] - 'a'] - 1) + ti * (j - pt[s[i] - 'a'] - 1) + te);
            pt[t[j] - 'a'] = j;
        }
        ps[s[i] - 'a'] = i;
    }
    cout << f[n][m];
}

#define file "c"
int main()
{
	#ifndef ONLINE_JUDGE
		freopen(file".in", "rt", stdin);
		freopen(file".out", "wt", stdout);
	#endif
	load();
	solve();
	return 0;
}
